﻿using System;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace HengTong.DataAccess.Migrations
{
    /// <inheritdoc />
    public partial class 人员入职表联错误修改 : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_SysPerson_SysPersonTrainExam_SysPersonTrainExamID",
                table: "SysPerson");

            migrationBuilder.DropColumn(
                name: "TrainExamId",
                table: "SysPerson");

            migrationBuilder.RenameColumn(
                name: "SysPersonTrainExamID",
                table: "SysPerson",
                newName: "SysPersonTrainExamId");

            migrationBuilder.RenameIndex(
                name: "IX_SysPerson_SysPersonTrainExamID",
                table: "SysPerson",
                newName: "IX_SysPerson_SysPersonTrainExamId");

            migrationBuilder.AddForeignKey(
                name: "FK_SysPerson_SysPersonTrainExam_SysPersonTrainExamId",
                table: "SysPerson",
                column: "SysPersonTrainExamId",
                principalTable: "SysPersonTrainExam",
                principalColumn: "ID");
        }

        /// <inheritdoc />
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_SysPerson_SysPersonTrainExam_SysPersonTrainExamId",
                table: "SysPerson");

            migrationBuilder.RenameColumn(
                name: "SysPersonTrainExamId",
                table: "SysPerson",
                newName: "SysPersonTrainExamID");

            migrationBuilder.RenameIndex(
                name: "IX_SysPerson_SysPersonTrainExamId",
                table: "SysPerson",
                newName: "IX_SysPerson_SysPersonTrainExamID");

            migrationBuilder.AddColumn<Guid>(
                name: "TrainExamId",
                table: "SysPerson",
                type: "uniqueidentifier",
                nullable: true);

            migrationBuilder.AddForeignKey(
                name: "FK_SysPerson_SysPersonTrainExam_SysPersonTrainExamID",
                table: "SysPerson",
                column: "SysPersonTrainExamID",
                principalTable: "SysPersonTrainExam",
                principalColumn: "ID");
        }
    }
}
